#include <iostream>
using namespace std;
int b;
int n;
int arr[51];
bool fun()
{
	for (int i = 0; i < n; i++)
	{
		if (b % arr[i]) return false;
		int x = b / arr[i];
		if (x - (x & -x)) return false;
	}
	return true;
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
		b = max(b, arr[i]);
	}
	if (fun()) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}